package Day03.HomeWork;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Demo2 {
    public static void main(String[] args) {
        try {
            FileOutputStream fos=new FileOutputStream("testpw.txt");
            OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
            BufferedWriter bw=new BufferedWriter(osw);
            PrintWriter pw=new PrintWriter(bw);
            pw.println("你好，我喜欢java");
            System.out.println("写出完毕");
            pw.close();

        }catch (Exception exception){
            System.err.println("有异常!");
        }
    }
}
